package com.erli.exchange.core.beans.api;

import lombok.Data;

/**
 * 
 * @Package com.erli.exchange.common.exception   
 * @ClassName:  ApiException   
 * @Description:TODO
 * @Author: LeeHo
 * @Date:   2019年3月10日 上午11:37:47   
 *
 */
@Data
public class ApiException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	private String msg;
	private int code = ResultEnum.SERVER_EXCEPTION.getCode();

	public ApiException(String msg) {
		super(msg);
		this.msg = msg;
	}

	public ApiException(String msg, Throwable e) {
		super(msg, e);
		this.msg = msg;
	}

	public ApiException(String msg, int code) {
		super(msg);
		this.msg = msg;
		this.code = code;
	}

	public ApiException(String msg, int code, Throwable e) {
		super(msg, e);
		this.msg = msg;
		this.code = code;
	}
	
	public ApiException(ExceptionEnum exceptionEnum) {
		super(exceptionEnum.getMsg());
		this.msg = exceptionEnum.getMsg();
		this.code = exceptionEnum.getCode();
	}
}
